home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Darts(Scram).dxr / Internal_97_comp darts.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  1.9 KB  |  66 lines

  1. property pSprite, spriteNum, ogRot, ogHe, ogWi, ogLoc, pOgHeight, pOgWidth, pHeightOfDart, pDistanceFromBoard, pBoardHeightFromGround, pGravity, pLoc, pPower, pDiffer
  2. global gCompDart
  3.  
  4. on beginSprite me
  5.   pSprite = sprite(spriteNum)
  6.   gCompDart.add(pSprite)
  7.   ogLoc = pSprite.loc
  8.   ogRot = pSprite.rotation
  9.   ogHe = pSprite.height
  10.   ogWi = pSprite.width
  11.   pOgHeight = pSprite.height
  12.   pOgWidth = pSprite.width
  13.   init()
  14. end
  15.  
  16. on init me
  17.   pDistanceFromBoard = 96
  18.   pBoardHeightFromGround = 68
  19.   pGravity = 0.25
  20.   pHeightOfDart = 28
  21.   pSprite.height = pOgHeight
  22.   pSprite.width = pOgWidth
  23.   pair = VOID
  24. end
  25.  
  26. on cleanUp me
  27.   pSprite.height = ogHe
  28.   pSprite.width = ogWi
  29.   pSprite.loc = ogLoc
  30.   pSprite.rotation = ogRot
  31.   init()
  32. end
  33.  
  34. on throw me, theTarget
  35.   set the floatPrecision to 4
  36.   pLoc = [290.0, 300.0]
  37.   pSprite.loc = point(pLoc[1], pLoc[2])
  38.   newloc = [sprite(theTarget).locH.float, sprite(theTarget).locV.float]
  39.   displace = [newloc[1] - pLoc[1], newloc[2] - pLoc[2]]
  40.   dislength = sqrt((displace[1] * displace[1]) + (displace[2] * displace[2]))
  41.   unit = [displace[1] / dislength, displace[2] / dislength]
  42.   thetotdist = dislength
  43.   dispos = 0
  44.   pScale = 1.0
  45.   fullScale = [pSprite.width.float, pSprite.height.float]
  46.   repeat while dislength > 5
  47.     pSprite.rotation = pSprite.rotation + 5
  48.     pSprite.height = fullScale[2] * pScale
  49.     pSprite.width = fullScale[1] * pScale
  50.     pLoc = pLoc + [unit[1] * 5, (unit[2] * 5) + dispos]
  51.     pSprite.loc = point(pLoc[1], pLoc[2])
  52.     displace = [newloc[1] - pLoc[1], newloc[2] - pLoc[2]]
  53.     dislength = sqrt((displace[1] * displace[1]) + (displace[2] * displace[2]))
  54.     ascale = dislength * 100.0 / thetotdist
  55.     if pScale > 0.25 then
  56.       pScale = abs((1.0 - ascale) / 100.0)
  57.     end if
  58.     updateStage()
  59.   end repeat
  60.   puppetSound(3, member("dart hit 2"))
  61.   s = the ticks + 25
  62.   repeat while the ticks < s
  63.     updateStage()
  64.   end repeat
  65. end
  66.